// src/utils/timeUtils.ts

 export function isNightTime(): boolean {
    const currentHour = new Date().getHours();
    return currentHour < 6 || currentHour >= 18;
  }

  export function isToday(date: Date): boolean {
    const today = new Date()
    return date.getDate() === today.getDate() &&
      date.getMonth() === today.getMonth() &&
      date.getFullYear() === today.getFullYear()
  }
  
  export function isThisWeek(date: Date): boolean {
    const now = new Date()
    const weekStart = new Date(now.getFullYear(), now.getMonth(), now.getDate() - now.getDay())
    const weekEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate() + (6 - now.getDay()))
    
    return date >= weekStart && date <= weekEnd
  }

  export const formatTime = (time: Date | string | undefined) => {
    if (!time) return '';
    const date = new Date(time);
    return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`;
  };